<template>
  <section id="notice">
    <div class="info_title">我的&nbsp;&gt;&nbsp;平台公告</div>
    <div class="content">
      <div class="list">
        <div
        
         
          @click="toDetail(item)"
          class="item"
          v-for="(item,index) in dataList.data"
          :key="index"
        >
          <div>
            {{item.title}}
            <sup>
              <img
                src="../../assets/image/icon_new.png"
                alt
                width="25"
                height="15"
                v-if="item.is_new=='1'"
              >
            </sup>
          </div>
          <div>{{$js.timeToDate(item.create_time)}}</div>
        </div>
      </div>
        <Page :total="dataList.total" :page-size="14" @on-change="pageChange" v-if="dataList" class-name="pageUserStyle" />
    </div>
  </section>
</template>
<script>
import { _getPNoticeList } from "@/axios/index.js";
export default {
  data() {
    return {
      params: {
        page: 1,
        pagesize: 14
      },
      dataList: "",
      nodadaBol: false
    };
  },
  methods: {
   
     pageChange(value){
       this.$set(this.params,"page",value);
       this.getMethod();
     },
    async getMethod() {
      var self = this;
      let res = await _getPNoticeList(self.params.page, self.params.pagesize);
      if (res.data.code == 200) {
        self.dataList=res.data.data;
        if (self.dataList.pages == 0) {
          self.nodadaBol = true;
        } else {
          self.nodadaBol = false;
        }
      }
    },
    toDetail(item){
      localStorage.setItem("curNotice",JSON.stringify(item));
      this.$router.push('/noticeDetail/'+item.id);
    }
  },
  created() {
   
    this.getMethod();
  },
  destroyed() {
   
  }
};
</script>
